<?php
namespace Plugin;

class Oss
{
    // 创建一个连接阿里云开放存储的客户端
    public static $accessKeyId     = "LTAINseafgvyLOpPv";
    public static $accessKeySecret = "GI4rtzzyIU3cK2hh9JPm6s6unnSnxA";
    // Endpoint以杭州为例，其它Region请按实际情况填写。
    public static $endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
    public static $ossClient;
    // 存储空间名称
    public static $bucket = "aaaa";
    // 文件名称
    public static $object = "Insert.php";
    public function __construct()
    {
        self::$ossClient = new OssClient(self::$accessKeyId, self::$accessKeySecret, self::$endpoint);
    }
    public static function uploadFile($bucket, $object, $filePath)
    {
        $data = self::$ossClient->uploadFile($bucket, $object, $filePath);
        return $data;
    }
    public static function putObject($bucket, $object, $filePath)
    {
        self::$ossClient = new OssClient(self::$accessKeyId, self::$accessKeySecret, self::$endpoint);
        $data            = self::$ossClient->putObject($bucket, $object, $filePath);
        return $data;
    }
}
